package com.tidc.commonality.api;

import com.tidc.commonality.fallbackFactory.StudentCheckProviderFallbackFactory;
import com.tidc.commonality.ov.UserOV;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassNmae Checkapi
 * @Description TODO
 * @Author 冯涛滔
 **/
@FeignClient(name = "CHECKPROVIDER",fallbackFactory = StudentCheckProviderFallbackFactory.class)
public interface StudentCheckApi {
	@ApiOperation("使用teamID和队长id获取整个队伍的队员的名字列表")
	@RequestMapping(value = "/student/check/team/{student_id}/{team_id}",method = RequestMethod.GET)
	public UserOV teamId(@PathVariable("student_id")int student_id, @PathVariable("team_id") int team_id);

	@ApiOperation("根据比赛id来返回比赛的详细信息 具体是/check/match/id(这里是数字,动态的)")
	@RequestMapping(value = "/student/check/match/{id}",method = RequestMethod.GET)
	public UserOV getmatches(@PathVariable("id") int id);

	@ApiOperation("当前登录的学生查看自己创建的所有比赛 但是如果没用创建过比赛就会返回一个空数组")
	@RequestMapping(value="/student/check/works",method = RequestMethod.GET)
	public UserOV myWorks(String token);

	@ApiOperation("根据参赛作品的id来查看该作品的详细信息包括队伍人员查询 具体是/check/work/id(这里是数字,动态的),如果是老师着可以无条件查询学生只能查看自己的")
	@RequestMapping(value = "/student/check/work/{id}",method = RequestMethod.GET)
	public UserOV getWorks(@PathVariable("id") int id,String token) ;

	@ApiOperation(value = "根据比赛id查看分数排行榜 返回所有人的比赛名字属性和分数总分和平均分")
	@RequestMapping(value = "/student/check/score/top/{id}",method=RequestMethod.GET)
	public UserOV getScoreTop(@PathVariable int id);

	@ApiOperation(value = "查询所有的比赛")
	@RequestMapping(value = "/student/check/match",method = RequestMethod.GET)
	public UserOV getMatches();

	@ApiOperation(value = "查询当前学生的学校的比赛")
	@RequestMapping(value = "/student/check/school/match",method = RequestMethod.GET)
	public UserOV getMyMatches(String token) ;

	@ApiOperation(value = "首页的比赛排行榜一共有8条")
	@RequestMapping(value = "/student/check/index/rank",method = RequestMethod.GET)
	public UserOV getIndexRank();

	@ApiOperation(value = "根据比赛类别查询当前类别的所有比赛")
	@RequestMapping(value = "/student/check/match/domain",method = RequestMethod.GET)
	public UserOV getDomainMatch(@RequestParam(defaultValue = "计算机") String domain, HttpServletRequest req);

	@ApiOperation(value = "模糊查找比赛")
	@RequestMapping(value = "/student/check/like/match",method = RequestMethod.GET)
	public UserOV likeMatch(@RequestParam String name);

	@ApiOperation("根据email查询学生")
	@RequestMapping(value = "/student/check/student",method = RequestMethod.GET)
	public UserOV checkStudent( String email);

	@ApiOperation("使用teamID获取整个team")
	@RequestMapping(value = "/student/check/team/{id}",method = RequestMethod.GET)
	public UserOV getTeam(@PathVariable("id")int id,String token);

	@ApiOperation("按分类获取所有以开始评分的已开始评分的比赛列表")
	@RequestMapping(value = "/student/check/top/match",method = RequestMethod.GET)
	public UserOV checkStudentMatch(String domain);


	@ApiOperation("返回当前老师所拥有可以评分的比赛(也就是过了比赛报名期的比赛)如果该老师没有创建任何比赛会返回404") //需要修改
	@RequestMapping(value = "/teacher/check/power",method = RequestMethod.GET)
	public UserOV getMatch(String token);

	@ApiOperation("返回当前老师创建的比赛,如果该老师没有创建任何比赛会返回404")
	@RequestMapping(value = "/teacher/check/match",method = RequestMethod.GET)
	public UserOV mymatchs(String token);

	@ApiOperation("根据比赛的id来查询所有的参赛作品 需要传入一个比赛id")
	@RequestMapping(value = "/teacher/check/work/{id}",method = RequestMethod.GET)
	public UserOV getMatchsWorks(@PathVariable int id);

	@ApiOperation("按照email查询老师")
	@RequestMapping(value = "/teacher/check/teacher",method = RequestMethod.GET)
	public UserOV checkTeacher(String email);

	@ApiOperation("根据id查看这个比赛有评分权限的老师")
	@RequestMapping(value = "/teacher/check/match/power/{id}",method = RequestMethod.GET)
	public UserOV checkMatchPower(@PathVariable("id") int id);


}
